<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ taglib uri="/webwork" prefix="ww"%>
<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
  <title>Completed Orders</title>
 </head>
 <body>

<%@ include file="/admin-header.html" %>

 <h3>Completed Orders</h3><ww:if test="hasActionErrors()">
   <ul>
    <ww:iterator value="actionErrors">
     <li>
      <ww:property/>
     </li>
    </ww:iterator>
   </ul>
  </ww:if>
  
   <table border="1">
   <tr>
    <th>Order ID</th>
    <th>Customer Full Name</th>
    <th width="200">Time of Order</th>
    <th>Shipping Option</th>
    <th>Current OrderStatus</th>
    <th>Select New Status</th>
    <th>Order Details</th>
   </tr>

    <ww:iterator value="orderList">
     <tr>
      <td align="right">
      <ww:property value="id"/>
      </td>
      <td>
       <ww:property value="firstName"/>&nbsp;<ww:property value="lastName"/>
      </td>
      
      <td><ww:property value="timeStamp"/></td>
      
      
           <td>
      <ww:property value="shippingOption.companyName"/>
      &nbsp; -
      <ww:property value="shippingOption.serviceName"/>
     </td>
     <td>
      <ww:property value="orderStatus.step"/>
      &nbsp; - &nbsp;
      <ww:property value="orderStatus.name"/>
     </td>
     <td>
     <form name="updateStatusForm" action="AdminStepUpdate.action">
     <ww:hidden name="updateOrderId" value="%{id}"/>
     <select name="newStatusId" size="1" style="width: 150px;">
     
     <ww:iterator value="validOrderStatuses" >
     <ww:if test="id == orderStatus.id">
        <option value="<ww:property value="id"/>" selected="selected" >
        <ww:property value="step"/> - <ww:property value="name"/></option>
      </ww:if>
     
      <ww:else>
        <option value="<ww:property value="id"/>">
        <ww:property value="step"/> - <ww:property value="name"/></option>
      </ww:else>
     </ww:iterator>
     
     </select>
     <input type="submit" value="Update Status">

      </form>
     </td>
      
      
      <td>
        <ww:a href="GetOrderDetails.action?orderId=%{id}">View Order Details</ww:a>
      </td>
     </tr>
    </ww:iterator>
   </table>
   <p align = "left">Showing orders <ww:property value="firstOrder"/> - <ww:property value="lastOrder"/> of <ww:property value="orderCount"/> </p> &nbsp
   <ww:if test="previousPage != null"><ww:a href="GetCompletedOrders.action?page=%{previousPage}">Previous</ww:a></ww:if>
   <ww:if test="nextPage != null"><ww:a href="GetCompletedOrders.action?page=%{nextPage}">Next</ww:a></ww:if>

</body>
</html>